package com.hyh.spring.controller;

import com.hyh.spring.damin.CommonResult;
import com.hyh.spring.service.AccountService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @BelongsPackage: com.hyh.spring.controller
 * @ClassName AccountController
 * @Author: hyhWTX
 * @CreateTime: 2023-06-06  12:27
 * @Description: TODO (一句话描述以下该类的功能)
 * @Version: 1.0
 */
@RestController
public class AccountController {

    @Resource
    AccountService accountService;

    /**
     * 扣减账户余额
     */
    @RequestMapping("/account/decrease")
    public CommonResult decrease(@RequestParam("userId") Long userId, @RequestParam("money") BigDecimal money){
        accountService.decrease(userId,money);
        return new CommonResult(200,"扣减账户余额成功！");
    }
}